package ru.jkff.jalgebra.order;

/**
 * User: jkff
 * Date: Aug 22, 2009
 * Time: 12:38:35 PM
 */
public abstract class Lattice<T> extends PartialOrder<T> {
    public abstract T sup(T a, T b);
    public abstract T inf(T a, T b);

    public Lattice<T> flip() {
        final Lattice<T> us = this;
        return new Lattice<T>() {
            public T sup(T a, T b)                 { return us.inf(a,b);           }
            public T inf(T a, T b)                 { return us.sup(a,b);           }
            public boolean isLessOrEqual(T a, T b) { return us.isLessOrEqual(b,a); }
        };
    }
}
